import uuid
import os
import logs
def getmac():
    MacText = "-1"  # 默认值
    address = hex(uuid.getnode())[2:]
    MacText = '-'.join(address[i:i + 2] for i in range(0, len(address), 2))
    print(MacText)
    return MacText
def createWifi():
    mac = getmac() #获取mac地址
    if mac != "-1":
        q = "sudo create_ap -m nat wlan0 eth0 BZ_WIFI_"+mac[6:16]+" 88888888 --no-virt"
        res = os.system(q)
        logs.addLog("create AP successful , wait user config.", q, str(res))
        return True
    else:
        return False
